public class AnimalTest {
    public static void main(String[] args) {
        System.out.println("正常方法调用-----");
        Animal animal = new Animal();
        animal.eat();

        Dog dog = new Dog();
        dog.eat();

        Cat cat = new Cat();
        cat.eat();

        System.out.println("多态方法调用");
        Animal animal1 = new Cat();
        animal1.eat();

        Animal animal2 = new Dog();
        animal2.eat();

        Cat cat1 = (Cat) animal1;
        cat1.eat();
        cat1.climbTree();

        Dog dog1 = (Dog) animal2;
        dog1.eat();
        dog1.lookDoor();

    }
}
